/**
 * @param {number[][]} costs
 * @return {number}
 */
export var minCost = function (costs) {
  let dp = costs[0]
  for (let i = 1; i < costs.length; i++) {
    const cur = []
    for (let j = 0; j < 3; j++) {
      cur[j] = Math.min(dp[(j + 1) % 3], dp[(j + 2) % 3]) + costs[i][j]
    }
    dp = cur
  }
  return Math.min(...dp)
}
